{include file="public_iframe:head"}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox float-e-margins">
		<div class="ibox-title">
			<h5>角色列表</h5>
			<div class="ibox-tools" style="margin-top: -9px;">
				<a href="javascript:location.reload();" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
			</div>
		</div>
		<div class="ibox-content">
			<div class="row row-lg">
				<div class="col-sm-12">
					<!--<h4 class="example-title"></h4>-->
					<a class="btn btn-primary" href="{:url('Admin/role_info')}">添加角色</a>
					<br/>
					<div class="table-responsive">
						<!--class="table table-bordered table-hover"-->
						<table data-toggle="table" class="table table-bordered table-hover">
							<thead>
							<tr  style="background: #f9f9f9;">
								<th>ID</th>
								<th>角色名称</th>
								<th>描述</th>
								<th>操作</th>
							</tr>
							</thead>
							<tbody>
							{volist name="list" id="vo"}
								<tr>
									<td>{$vo.role_id}</td>
									<td>{$vo.role_name}</td>
									<td>{$vo.role_desc}</td>
									<td>
										<a href="{:url('Admin/role_info',array('role_id'=>$vo['role_id']))}" class="btn btn-primary">编辑</a>
										<a href="javascript:void(0)" data-url="{:url('Admin/roleDel')}" data-id="{$vo.role_id}" onclick="delfun(this)" class="btn btn-danger" >删除</a>
									</td>
								</tr>
							{/volist}
							</tbody>
						</table>
					</div>
				</div>
				<div class="col-sm-12">
					<!-- Example Pagination -->
					<div class="example-wrap">

					</div>
					<!-- End Example Pagination -->
				</div>
			</div>
		</div>
	</div>
	<!-- End Panel Basic -->
</div>

<!-- 全局js -->
<script src="__STATIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script>
	$(document).ready(function(){
		// 点击刷新数据
		$('.fa-refresh').click(function(){
			location.href = location.href;
		});

	});


	function delfun(obj) {
		// 删除按钮
		parent.layer.confirm('确认删除？', {
			btn: ['确定', '取消'] ,//按钮
			shade: false
		}, function () {
			$.ajax({
				type: 'post',
				url: $(obj).attr('data-url'),
				data : {role_id:$(obj).attr('data-id')},
				dataType: 'json',
				success: function (data) {
					if (data == 1) {
						$(obj).parent().parent().parent().remove();
						parent.layer.closeAll();
					} else {
						parent.layer.alert('删除失败', {
							icon: 2,
							shade: false
						});  //alert('删除失败');
					}
				}
			})
		}, function () {
		});
	}
</script>
</body>
</html>